<!DOCTYPE html>
<html>
<head>
    <title>查看--中软高科-2015</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css"/>
    <link rel="stylesheet" type="text/css" href="../Css/style.css"/>
    <script type="text/javascript" src="../Js/jquery.js"></script>
    <script type="text/javascript" src="../Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>
    <script type="text/javascript" src="../Js/ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="../Js/webUtil.js"></script>

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }

        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
    <script type="text/javascript">
        $(function () {
            let pre=document.location.toString().GetValue("pre");
            $('#backid').click(function () {
                window.location.href = pre+".html";
            });
        });
    </script>
</head>
<body>
<form action="index.html" method="post" class="definewidth m20">
    <table class="table table-bordered table-hover definewidth m10">
        <tr>
            <td width="10%" class="tableleft">姓名</td>
            <td id="name"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">证件类型</td>
            <td>身份证</td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">证件号</td>
            <td id="idCard"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">社保号</td>
            <td id="medical"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">联系电话</td>
            <td id="phone"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">是否自费</td>
            <td id="selfPrice"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">性别</td>
            <td id="sex"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">年龄</td>
            <td id="age"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">职业</td>
            <td id="work"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">初复诊</td>
            <td id="lookDoctor"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">所挂科室</td>
            <td id="department"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">所患疾病</td>
            <td id="illness"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">指定医生</td>
            <td id="doctorName"></td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">押金余额</td>
            <td id="deposit"></td>
        </tr>

        <tr>
            <td width="10%" class="tableleft">备注</td>
            <td id="remark"></td>
        </tr>
        <tr>
            <td colspan="2">
                <center>
                    <button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
                </center>
            </td>
        </tr>
    </table>
</form>
</body>
</html>
<script>
    function loadData() {
        let url = document.location.toString();
        let id = url.GetValue("id");
        if (id == null) {
            alert("非法id!");
        } else {
            $.ajax({
                type: "GET",
                url: "/hospitals/" + id,
                success: function (vo) {
                    if (vo.code == 200) {
                        let obj = vo.obj;
                        let pricePeopleList = obj.pricePeople;
                        let total = 0;
                        for (let i = 0; i < pricePeopleList.length; i++) {
                            let pricePeople = pricePeopleList[i];
                            total += pricePeople.chargeProject.money;
                        }
                        let deposit = obj.deposit;
                        let remain = deposit - total;
                        $("#name").html(obj.patient.name);
                        $("#idCard").html(obj.patient.idCard);
                        $("#medical").html(obj.patient.medical);
                        $("#phone").html(obj.patient.phone);
                        $("#selfPrice").html(obj.patient.selfPrice == 0 ? "否" : "是");
                        $("#sex").html(obj.patient.sex == 0 ? "男" : "女");
                        $("#age").html(obj.patient.age);
                        $("#work").html(obj.patient.work);
                        $("#lookDoctor").html(obj.patient.lookDoctor == 0 ? "初诊" : "复诊");
                        $("#department").html(obj.patient.doctor.department.name);
                        $("#doctorName").html(obj.patient.doctor.name);
                        $("#deposit").html(remain);
                        $("#remark").html(obj.remark);
                        $("#illness").html(obj.illness);
                    } else
                        alert(vo.msg)
                }
            })
        }
    }
    $(function () {
        loadData();
    })
</script>